
"""
Created on Tue Feb 19 14:55:43 2013

@author: aponteeduarddo@gmail.com
Copyright Eduardo Aponte 2013.
"""

from mex_binder import binder_py

eyelink_event_type_flags = binder_py('mx_eyelink_event_type_flags')
eyelink_event_type_flags.mx_c.headers = ['<eyelink.h>','"mex.h"']
eyelink_event_type_flags.bindo += []
eyelink_event_type_flags.mx_c.code = \
"""
INT16 _main( void )
{
    return eyelink_event_type_flags( ); 
}

void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
    mwSize td[2] = {1,1};
    double *status;
    
    /* Verify input arguments. */
    if(nrhs != 0 ) {
        mexErrMsgTxt("Incorrect number of inputs.");
    } else if( nlhs > 1 ) {
        mexErrMsgTxt("Too many output arguments.");
    }
    
        
    plhs[0] = mxCreateNumericArray( 2, td, mxDOUBLE_CLASS, mxREAL);
    status = mxGetPr(plhs[0]);    
    *status = (double ) _main( );
    return;
}
"""

eyelink_event_type_flags.mx_c.mdoc = \
"""function [ flag ] = mx_eyelink_event_type_flags( )
%MX_EYELINK_EVENT_TYPE_FLAGS After at least one button or eye event has been 
% read, can be used to check what type of events will be available.
%
% Returns:
% A set of bit flags: LEFTEYE_EVENTS if has left eye events. RIGHTEYE_EVENTS 
% if has right eye events. BLINK_EVENTS if has blink events. FIXATION_EVENTS 
% if has fixation events. FIXUPDATE_EVENTS if has fixation updates. 
% SACCADE_EVENTS if has saccade events. MESSAGE_EVENTS if has message events. 
% BUTTON_EVENTS if has button events. INPUT_EVENTS if has input port events.
%
% LEFTEYE_EVENTS   0x8000 /*!< has left eye events */
% RIGHTEYE_EVENTS  0x4000 /*!< has right eye events */
% BLINK_EVENTS     0x2000 /*!< has blink events */
% FIXATION_EVENTS  0x1000 /*!< has fixation events */
% FIXUPDATE_EVENTS 0x0800 /*!< has fixation updates */
% SACCADE_EVENTS   0x0400 /*!< has saccade events */
% MESSAGE_EVENTS   0x0200 /*!< has message events */
% BUTTON_EVENTS    0x0040 /*!< has button events */
% INPUT_EVENTS     0x0020 /*!< has input port events */
"""
eyelink_event_type_flags.write_c()
eyelink_event_type_flags.write_m()
eyelink_event_type_flags.compile()
eyelink_event_type_flags.write_sh()

